perm filename MCMPLR.PUB[HAL,HE]1 blob sn#127025 filedate 1974-10-29 generic text, type T, neo UTF8
.NEWSEC SOURCE LANGUAGE,COMPILER

	The following is a description of the source language of HAL.
We will discuss the structure of the compiler, and then these areas of
the  language:  control  structures,     data  structures,     motion
specifications, and various compile time constructs.

.com: NEWSS THE HAL COMPILER

The HAL compiler is built of three parts: the parser, the expander,
and the trajectory calculator.  These are depicted in
{NEWFIG The HAL compiler,FULL,com←}.

.NEWSSS PARSER

	The PARSER  reads source code  from either  the console or  a
file.    Its  purpose is  to  form  parse trees  and  do  some simple
manipulations,  such as assigning line numbers,  causing  listings to
be  directed to  the appropriate  file (if  desired), expanding  text
macros,   and keeping a primitive symbol table.  If a syntax error is
discovered,  it  informs the  supervisor,  which  will give the  user
several  options,  including  aborting the compilation,  making local
modifications on  the  spot,   or  switching temporarily  to  a  text
editor.  In many cases,  control will be returned to the parser,  and
it will continue to create parse trees from the input.

.NEWSSS EXPANDER  
  
The EXPANDER shares with the trajectory calculator the responsibility
for turning parser output into code interpretable by the runtime
system.  Its main functions are to maintain a model of the
expected runtime state at each point in the program and to use this
model to resolve a number of compile-time decisions.  The information
kept includes expected variable values,
object descriptions, relations
between objects, endpoint constraints on particular trajectories, and
much more.  Simple uses of this information include providing
the trajectory calculator with essential data and resolving
conditional compilation requests.  Beyond this, the expander
has principal responsibility for filling in the details required
to turn calls on various high and intermediate level primitives
into runnable manipulation programs.  It therefore
contains a number of quite specialized routines with considerable
knowledge about the domain of mechanical assembly, as well as a number
of more general mechanisms for coordinating the specialists.

The expander supplies to the trajectory calculator a structure which is
very similar to the parse trees it
accepts as input.  However, no choices are left; all values have been
explicitly specified.

.NEWSSS TRAJECTORY CALCULATOR

	The  TRAJECTORY  CALCULATOR  takes  the   expanded  code  and
computes  the  required   trajectories  for  the  arms.    Tables  of
interpretable  code are  generated    for  handling  arithmetic  and
assignment operations,   condition  monitoring,   and graph-structure
building  operations  (the  runtime system  keeps  track  of physical
attachment of  objects).   For  motions,   detailed instructions  are
emitted specifying  how each joint  of each arm  is to behave,   what
computations to  make  at  run-time for  the  modification  of  these
trajectories to bring them into correspondence with the current state
of the world (for it happens often that objects are not exactly where
they were planned to be),  and what conditions to monitor during  the
motion.

	The trajectory calculator also is used to provide information
to the expander.   For instance,  it can  predict the runtime effects
of a given modification of a planned trajectory.  This information is
useful to the expander in deciding  how many "different" trajectories
must be planned for a given motion request.
	There are  several errors which the trajectory calculator can
detect.  A request might take  the arm outside its range, or force  a
joint to exceed its velocity limits.  It may discover that there is a
possibility of collision between the two arms,  or between the arm and
some object on the table.  In order to carry out these tests,  it may
request  assurance  from the  user  that some  object  lies within  a
certain region,  or it may give the user a warning.  The world  model
is  used for  much  of  this calculation.    At its  discretion,  the
trajectory calculator  may make some critical motions  very slow,  so
that an impending collision will be detected before it happens. 

	The output of the  trajectory calculator is stored in  binary
files,  for loading into the PDP11.